package com.example.shop.adapter

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.CarEntity
import com.example.shop.R
import com.example.shop.utils.GlideUtils

class CartAdapter(list: MutableList<CarEntity>):BaseQuickAdapter<CarEntity,BaseViewHolder>(R.layout.item_cart,list) {
    override fun convert(holder: BaseViewHolder, item: CarEntity) {
        holder.setText(R.id.cart_desc,item.goods_desc)
        holder.setText(R.id.cart_price,"单价：${item.goods_default_price}元")
        holder.setText(R.id.cart_num,"${item.count}")
        GlideUtils.loadImage(context,item.goods_default_icon,holder.getView(R.id.cart_iv))
        holder.getView<CheckBox>(R.id.cb).isChecked = item.isChecked
    }
}